<?php

namespace app\api\controller;

use app\api\service\UserCollectService;
use app\ApiController;

class UserCollectController extends ApiController
{
    /**
     * 我的收藏
     */
    public function myCollect()
    {
        $param = request()->all();
        $userCollectService = new UserCollectService();
        return sparkSuccess($userCollectService->getMyCollect($param));
    }

    /**
     * 收藏
     */
    public function add()
    {
        $param = request()->all();

        $userCollectService = new UserCollectService();
        return sparkSuccess($userCollectService->addCollect($param));
    }

    /**
     * 移除收藏
     */
    public function remove()
    {
        $userCollectService = new UserCollectService();
        return sparkSuccess($userCollectService->removeCollect( request()->input('id')));
    }

    /**
     * 通过goods_id 移除收藏
     */
    public function removeByGoodsId()
    {
        $userCollectService = new UserCollectService();
        return sparkSuccess($userCollectService->removeCollectByGoodsId( request()->input('id')));
    }

}
